package com.snjx.admui.master.common;

import lombok.extern.log4j.Log4j;

/**
 * 
* @ClassName: DynamicDataSourceHolder 
* @Description: TODO(数据源操作) 
* @author zyl
* @date 2017年2月21日 下午2:16:34 
*
 */
@Log4j
public class DynamicDataSourceHolder {
	
	//线程 本地环境
	public static final ThreadLocal<String> holder = new ThreadLocal<String>();
    //设置数据源
    public static void putDataSource(String name) {
        holder.set(name);
        log.info("obtain DataSource Successful:"+name);
    }
    //获取数据源
    public static String getDataSouce() {
    	log.info("get the present DataSouce Successful");
        return holder.get();
    }
    //清除数据源
    public static void clearDataSouce() {
    	log.info("Clear present DataSouce Successful");
		holder.remove();
	}
}
